<!--
 * @FilePath     : /study_code/layui/13-2-27.html
 * @Description  : style 自定义单元格文本对齐方式
 * @Date         : 2025-04-07 17:14:26
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-04-08 14:01:18
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <link rel="stylesheet" href="/layui/dist/css/layui.css" />
  </head>
  <body>
    <table id="demo" lay-filter="test"></table>

    <script src="/layui/dist/layui.js"></script>
    <script src="/layui/table/common.js"></script>
    <script>
      var table = layui.table

      table.render({
        elem: '#demo',
        data: tableData,

        cols: [
          [
            {
              field: 'id',
              title: 'ID',
              minWidth: 400,
            },
            {
              field: 'sex',
              title: '性别',
              width: 50,

              /**
               * @brief: 自定义单元格样式
               * @value {string} style
               */
              style: 'background-color: #5FB878; color: #fff;',
            },
            {
              field: 'score',
              title: '评分',
              width: '20%',
              width: 120,
            },
          ],
        ],
      })
    </script>
  </body>
</html>